home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 8 / Revista do CD-ROM 8.iso / dados / program / skyborg / skyborg.exe / SHARED.DXR / 01002_MotionEngine.ls < prev    next >
Encoding:
Text File  |  1995-07-24  |  18.2 KB  |  415 lines

  1. on ShowSite whichSite, whichTransID, whichSound
  2.   global cCurrentView, cPanView, myCast, gFightMode, cView.Left, cView.Top, cView.Right, cView.Bottom, gCurrentRegions, gNewSiteSound, gSpecialFrameLast, cDragSprite, cMaxRegions, cPanFirstRegion, cLayerSoundSprite, gMixSound, gLastSound
  3.   set whichSite to CheckAltSites(whichSite)
  4.   set gCurrentSite to whichSite
  5.   set baseSite to GetBaseSite(whichSite)
  6.   if whichTransID < 0 then
  7.     set thisCast to getaProp(myCast, baseSite)
  8.     set the castNum of sprite cPanView to thisCast
  9.     MakeRegions(whichSite, whichTransID, "P")
  10.     PanView(whichTransID)
  11.     ClearPanSites()
  12.     set whichTransID to 0
  13.   end if
  14.   set thisCast to getaProp(myCast, baseSite)
  15.   set the castNum of sprite cCurrentView to thisCast
  16.   MakeRegions(whichSite, whichTransID, "N")
  17.   if whichTransID > 0 then
  18.     puppetTransition(integer(whichTransID), 0, 16, 1)
  19.   end if
  20.   UpdateEnv()
  21.   updateStage()
  22.   if the freeBytes < (500 * 1024) then
  23.     unLoadCast(801, 999)
  24.   end if
  25.   if whichTransID = 23 then
  26.     if not gFightMode then
  27.       unLoadCast()
  28.     end if
  29.   end if
  30. end
  31.  
  32. on ProcessRegion whichSprite
  33.   global gCurrentRegions, gCurrentEnv, cMaxRegions, gCurrentSite, myCast, cBackSoundSprite, gNewSiteSound, cSiteFirstRegion, cLayerSoundSprite, cEnvType, gCurrentDrag, cDragSprite, cHUDSprite, cArmSprite, gInvArmState, gMixSound, gLastSound
  34.   spriteBox(cDragSprite, 0, 500, 1, 501)
  35.   updateStage()
  36.   set RegionIndex to whichSprite - cSiteFirstRegion + 1
  37.   set myScript to "NONE"
  38.   if item 12 of line RegionIndex of gCurrentRegions <> EMPTY then
  39.     set myScript to item 12 of line RegionIndex of gCurrentRegions
  40.     set myCharCount to the number of chars in myScript
  41.     set thisScriptType to char myCharCount - 1 to myCharCount of myScript
  42.     delete char myCharCount - 1 to myCharCount of myScript
  43.     if thisScriptType = "_B" then
  44.       do(myScript)
  45.     end if
  46.   end if
  47.   if item 2 of line RegionIndex of gCurrentRegions = "M" then
  48.     repeat with thisEnv = 1 to the number of lines in gCurrentEnv
  49.       if gCurrentSite = item 1 of line thisEnv of gCurrentEnv then
  50.         if item 2 of line thisEnv of gCurrentEnv = "OB" then
  51.           set thisObject to item 4 of line thisEnv of gCurrentEnv
  52.           set lastSprite to the number of lines in gCurrentRegions + cSiteFirstRegion - 1
  53.           repeat with thisSprite = cSiteFirstRegion to lastSprite
  54.             if item 7 of line thisSprite + 1 - cSiteFirstRegion of gCurrentRegions = thisObject then
  55.               if CheckState(thisObject) = item 3 of line thisEnv of gCurrentEnv then
  56.                 exit repeat
  57.               end if
  58.               SetState(thisObject, item 3 of line thisEnv of gCurrentEnv)
  59.               set thisGraphic to thisObject & "_" & GetBaseSite(gCurrentSite) & "_" & CheckState(thisObject)
  60.               set thisTrans to integer(item 5 of line thisEnv of gCurrentEnv)
  61.               set thisSound to item 6 of line thisEnv of gCurrentEnv
  62.               set thisCast to getAt(myCast, findPos(myCast, thisGraphic))
  63.               set the castNum of sprite thisSprite to thisCast
  64.               if thisSound <> EMPTY then
  65.                 myPlaySound(thisSound)
  66.               end if
  67.               puppetTransition(thisTrans, 0, 16, 1)
  68.               updateStage()
  69.               exit repeat
  70.             end if
  71.           end repeat
  72.         end if
  73.       end if
  74.     end repeat
  75.     set gCurrentSite to item 7 of line RegionIndex of gCurrentRegions
  76.     set gNewSiteSound to item 11 of line RegionIndex of gCurrentRegions
  77.     if gNewSiteSound <> EMPTY then
  78.       myPlaySound(gNewSiteSound)
  79.     end if
  80.     if thisScriptType = "_M" then
  81.       do(myScript)
  82.     end if
  83.     ShowSite(gCurrentSite, item 10 of line RegionIndex of gCurrentRegions)
  84.     if thisScriptType = "_A" then
  85.       do(myScript)
  86.     end if
  87.     exit
  88.   end if
  89.   if item 2 of line RegionIndex of gCurrentRegions = "S" then
  90.     set thisObject to item 7 of line RegionIndex of gCurrentRegions
  91.     set dragObjRequired to item 8 of line RegionIndex of gCurrentRegions
  92.     set checkDragItem to GetBaseItem(gCurrentDrag)
  93.     if dragObjRequired <> EMPTY then
  94.       if dragObjRequired <> checkDragItem then
  95.         exit
  96.       end if
  97.     end if
  98.     ChangeState(thisObject)
  99.     set gNewSiteSound to item 11 of line RegionIndex of gCurrentRegions
  100.     if gNewSiteSound <> EMPTY then
  101.       myPlaySound(gNewSiteSound)
  102.     end if
  103.     if thisScriptType = "_M" then
  104.       do(myScript)
  105.     end if
  106.     ShowSite(gCurrentSite, item 10 of line RegionIndex of gCurrentRegions, item 11 of line RegionIndex of gCurrentRegions)
  107.     if thisScriptType = "_A" then
  108.       do(myScript)
  109.     end if
  110.     exit
  111.   end if
  112.   if item 2 of line RegionIndex of gCurrentRegions = "DS" then
  113.     set thisObject to item 7 of line RegionIndex of gCurrentRegions
  114.     set thisDragCast to thisObject & "-WD"
  115.     set gNewSiteSound to item 11 of line RegionIndex of gCurrentRegions
  116.     if gNewSiteSound <> EMPTY then
  117.       myPlaySound(gNewSiteSound)
  118.     end if
  119.     if the doubleClick then
  120.       ChangeState(thisObject)
  121.       puppetSprite(cDragSprite, 1)
  122.       set thisCast to getAt(myCast, findPos(myCast, thisDragCast))
  123.       set the castNum of sprite cDragSprite to thisCast
  124.       set the ink of sprite cDragSprite to 36
  125.       set the rect of sprite cDragSprite to the rect of cast thisDragCast
  126.       set the locH of sprite cDragSprite to the mouseH
  127.       set the locV of sprite cDragSprite to the mouseV
  128.       slideSprite(cDragSprite, 320, 420)
  129.       AddToInv(thisObject)
  130.     else
  131.       set originalH to the mouseH
  132.       set originalV to the mouseV
  133.       puppetSprite(cDragSprite, 1)
  134.       set thisCast to getAt(myCast, findPos(myCast, thisDragCast))
  135.       set the castNum of sprite cDragSprite to thisCast
  136.       set the ink of sprite cDragSprite to 36
  137.       set the rect of sprite cDragSprite to the rect of cast thisDragCast
  138.       set the locH of sprite cDragSprite to the mouseH
  139.       set the locV of sprite cDragSprite to the mouseV
  140.       updateStage()
  141.       repeat while the mouseDown
  142.         set the locH of sprite cDragSprite to the mouseH
  143.         set the locV of sprite cDragSprite to the mouseV
  144.         updateStage()
  145.       end repeat
  146.       if sprite cDragSprite intersects cHUDSprite then
  147.         ChangeState(thisObject)
  148.         AddToInv(thisObject)
  149.         if gInvArmState = 1 then
  150.           ShowInvArm()
  151.         end if
  152.       else
  153.         slideSprite(cDragSprite, originalH, originalV)
  154.       end if
  155.     end if
  156.     spriteBox(cDragSprite, 0, 500, 1, 501)
  157.     updateStage()
  158.     if thisScriptType = "_M" then
  159.       do(myScript)
  160.     end if
  161.     ShowSite(gCurrentSite, item 10 of line RegionIndex of gCurrentRegions, item 11 of line RegionIndex of gCurrentRegions)
  162.     if thisScriptType = "_A" then
  163.       do(myScript)
  164.     end if
  165.     exit
  166.   end if
  167.   if item 2 of line RegionIndex of gCurrentRegions = "C" then
  168.     set CardName to item 7 of line RegionIndex of gCurrentRegions
  169.     doCardMode(CardName)
  170.     if thisScriptType = "_A" then
  171.       do(myScript)
  172.     end if
  173.     exit
  174.   end if
  175.   if item 2 of line RegionIndex of gCurrentRegions = "Z" then
  176.     set thisFrame to item 7 of line RegionIndex of gCurrentRegions
  177.     ShowSite(gCurrentSite, 0, EMPTY)
  178.     go(thisFrame)
  179.     if thisScriptType = "_A" then
  180.       do(myScript)
  181.     end if
  182.     exit
  183.   end if
  184.   if item 2 of line RegionIndex of gCurrentRegions = "B" then
  185.     if thisScriptType = "_A" then
  186.       do(myScript)
  187.     end if
  188.     exit
  189.   end if
  190. end
  191.  
  192. on PanView whichTransID
  193.   global gCurrentRegions, gPanRegions, cPanView, cCurrentView, cMaxRegions, cSiteFirstRegion, cPanFirstRegion
  194.   set thePanCount to 4
  195.   if whichTransID = "-2" then
  196.     set theHorizontalShift to -640
  197.     set thePanSize to 160
  198.   else
  199.     set theHorizontalShift to 640
  200.     set thePanSize to -160
  201.   end if
  202.   set cView.Left to 0
  203.   set cView.Top to 0
  204.   set cView.Right to 640
  205.   set cView.Bottom to 390
  206.   spriteBox(cPanView, cView.Left + theHorizontalShift, cView.Top, cView.Right + theHorizontalShift, cView.Bottom)
  207.   set PanCount to the number of lines in gPanRegions
  208.   set RegionCount to the number of lines in gCurrentRegions
  209.   repeat with SpriteCount = 1 to RegionCount
  210.     set whichSprite to SpriteCount + cSiteFirstRegion - 1
  211.   end repeat
  212.   repeat with count = 1 to thePanCount
  213.     set the locH of sprite cCurrentView to the locH of sprite cCurrentView + thePanSize
  214.     set the locH of sprite cPanView to the locH of sprite cPanView + thePanSize
  215.     repeat with SpriteCount = 1 to RegionCount
  216.       set whichSprite to SpriteCount + cSiteFirstRegion - 1
  217.       spriteBox(whichSprite, the left of sprite whichSprite + thePanSize, the top of sprite whichSprite, the right of sprite whichSprite + thePanSize, the bottom of sprite whichSprite)
  218.     end repeat
  219.     repeat with SpriteCount = 1 to PanCount
  220.       set whichSprite to SpriteCount + cPanFirstRegion - 1
  221.       set the locH of sprite whichSprite to the locH of sprite whichSprite + thePanSize
  222.     end repeat
  223.     updateStage()
  224.   end repeat
  225. end
  226.  
  227. on MakeRegions whichSite, whichTransID, makeType
  228.   global gPanRegions, gClickRegionIndex, gClickRegions, gCurrentRegions, cMaxRegions, cSiteFirstRegion, cPanFirstRegion, cRegionInk, cRegionCast, gNeutralCursor, gCurrentSite, gCurrentEnv, gRobotSprite, gFightMode, gRobotAlive, gRobotPathIndex
  229.   set myRegions to GetRegions(whichSite)
  230.   set RegionCount to the number of lines in myRegions
  231.   if makeType = "N" then
  232.     set gCurrentRegions to myRegions
  233.     set myFirstSprite to cSiteFirstRegion
  234.   else
  235.     repeat with thisRegion = 1 to RegionCount
  236.       if thisRegion > the number of lines in myRegions then
  237.         exit repeat
  238.       end if
  239.       if item 2 of line thisRegion of myRegions = "M" then
  240.         if item 8 of line thisRegion of myRegions = EMPTY then
  241.           delete line thisRegion of myRegions
  242.           set thisRegion to thisRegion - 1
  243.         end if
  244.       end if
  245.     end repeat
  246.     set gPanRegions to myRegions
  247.     set myFirstSprite to cPanFirstRegion
  248.   end if
  249.   if whichTransID < 0 then
  250.     if whichTransID = "-2" then
  251.       set theHorizontalShift to -640
  252.     else
  253.       set theHorizontalShift to 640
  254.     end if
  255.   else
  256.     set theHorizontalShift to 0
  257.   end if
  258.   if gCurrentRegions = EMPTY then
  259.     exit
  260.   end if
  261.   set gFightMode to 0
  262.   repeat with count = 1 to cMaxRegions
  263.     if count <= RegionCount then
  264.       if (item 2 of line count of myRegions = "F") and (makeType = "N") then
  265.         if gRobotAlive then
  266.           set gFightMode to 1
  267.           set thisSprite to count + myFirstSprite - 1
  268.           set gRobotSprite to thisSprite
  269.         else
  270.           set thisSprite to count + myFirstSprite - 1
  271.           set the backColor of sprite gRobotSprite to 0
  272.           spriteBox(thisSprite, 0, 500, 1, 501)
  273.         end if
  274.       end if
  275.       if (item 2 of line count of myRegions = "FB") and (makeType = "N") and gRobotAlive then
  276.         set thisSprite to count + myFirstSprite - 1
  277.         set thisObject to item 7 of line count of myRegions
  278.         set temp.left to integer(item 3 of line count of myRegions) + theHorizontalShift
  279.         set temp.top to integer(item 4 of line count of myRegions)
  280.         set temp.right to integer(item 5 of line count of myRegions) + theHorizontalShift
  281.         set temp.bottom to integer(item 6 of line count of myRegions)
  282.         set thisCast to getAt(myCast, findPos(myCast, thisObject))
  283.         set the castNum of sprite thisSprite to thisCast
  284.         spriteBox(thisSprite, temp.left, temp.top, temp.right, temp.bottom)
  285.         set the ink of sprite thisSprite to 8
  286.       end if
  287.       if item 2 of line count of myRegions = "M" then
  288.         set thisSprite to count + myFirstSprite - 1
  289.         set temp.left to integer(item 3 of line count of myRegions) + theHorizontalShift
  290.         set temp.top to integer(item 4 of line count of myRegions)
  291.         set temp.right to integer(item 5 of line count of myRegions) + theHorizontalShift
  292.         set temp.bottom to integer(item 6 of line count of myRegions)
  293.         if item 8 of line count of myRegions = EMPTY then
  294.           set the ink of sprite thisSprite to cRegionInk
  295.           set the castNum of sprite thisSprite to cRegionCast
  296.         else
  297.           set thisGraphic to item 8 of line count of myRegions
  298.           set thisCast to getaProp(myCast, thisGraphic)
  299.           set the castNum of sprite thisSprite to thisCast
  300.           set the ink of sprite thisSprite to 8
  301.         end if
  302.         spriteBox(thisSprite, temp.left, temp.top, temp.right, temp.bottom)
  303.         set thisCast to item 9 of line count of myRegions
  304.         set whichCursor to getaProp(myCast, thisCast)
  305.         set thisCast to thisCast & "_Mask"
  306.         set whichCursorMask to getaProp(myCast, thisCast)
  307.         set whichCursor to [whichCursor, whichCursorMask]
  308.         set the cursor of sprite thisSprite to whichCursor
  309.       end if
  310.       if item 2 of line count of myRegions = "S" then
  311.         set thisSprite to count + myFirstSprite - 1
  312.         set thisObject to item 7 of line count of myRegions
  313.         put "_" & GetBaseSite(whichSite) & "_" & CheckState(thisObject) after thisObject
  314.         set temp.left to integer(item 3 of line count of myRegions) + theHorizontalShift
  315.         set temp.top to integer(item 4 of line count of myRegions)
  316.         set temp.right to integer(item 5 of line count of myRegions) + theHorizontalShift
  317.         set temp.bottom to integer(item 6 of line count of myRegions)
  318.         set thisCast to getaProp(myCast, thisObject)
  319.         set the castNum of sprite thisSprite to thisCast
  320.         spriteBox(thisSprite, temp.left, temp.top, temp.right, temp.bottom)
  321.         set the ink of sprite thisSprite to 8
  322.         set thisCast to item 9 of line count of myRegions
  323.         set whichCursor to getaProp(myCast, thisCast)
  324.         set thisCast to thisCast & "_Mask"
  325.         set whichCursorMask to getaProp(myCast, thisCast)
  326.         set whichCursor to [whichCursor, whichCursorMask]
  327.         set the cursor of sprite thisSprite to whichCursor
  328.       end if
  329.       if item 2 of line count of myRegions = "DS" then
  330.         set thisSprite to count + myFirstSprite - 1
  331.         set thisObject to item 7 of line count of myRegions
  332.         put "_" & GetBaseSite(whichSite) & "_" & CheckState(thisObject) after thisObject
  333.         set temp.left to integer(item 3 of line count of myRegions) + theHorizontalShift
  334.         set temp.top to integer(item 4 of line count of myRegions)
  335.         set temp.right to integer(item 5 of line count of myRegions) + theHorizontalShift
  336.         set temp.bottom to integer(item 6 of line count of myRegions)
  337.         set thisCast to getaProp(myCast, thisObject)
  338.         set the castNum of sprite thisSprite to thisCast
  339.         spriteBox(thisSprite, temp.left, temp.top, temp.right, temp.bottom)
  340.         set the ink of sprite thisSprite to 8
  341.         set thisCast to item 9 of line count of myRegions
  342.         set whichCursor to getaProp(myCast, thisCast)
  343.         set thisCast to thisCast & "_Mask"
  344.         set whichCursorMask to getaProp(myCast, thisCast)
  345.         set whichCursor to [whichCursor, whichCursorMask]
  346.         set the cursor of sprite thisSprite to whichCursor
  347.       end if
  348.       if item 2 of line count of myRegions = "B" then
  349.         set thisSprite to count + myFirstSprite - 1
  350.         set thisObject to item 7 of line count of myRegions
  351.         set temp.left to integer(item 3 of line count of myRegions) + theHorizontalShift
  352.         set temp.top to integer(item 4 of line count of myRegions)
  353.         set temp.right to integer(item 5 of line count of myRegions) + theHorizontalShift
  354.         set temp.bottom to integer(item 6 of line count of myRegions)
  355.         set thisCast to getaProp(myCast, thisObject)
  356.         set the castNum of sprite thisSprite to thisCast
  357.         spriteBox(thisSprite, temp.left, temp.top, temp.right, temp.bottom)
  358.         set the ink of sprite thisSprite to 8
  359.         set thisCast to item 9 of line count of myRegions
  360.         set whichCursor to getaProp(myCast, thisCast)
  361.         set thisCast to thisCast & "_Mask"
  362.         set whichCursorMask to getaProp(myCast, thisCast)
  363.         set whichCursor to [whichCursor, whichCursorMask]
  364.         set the cursor of sprite thisSprite to whichCursor
  365.       end if
  366.       if (item 2 of line count of myRegions = "C") and (makeType = "N") then
  367.         set thisSprite to count + myFirstSprite - 1
  368.         set thisObject to item 7 of line count of myRegions
  369.         set temp.left to integer(item 3 of line count of myRegions) + theHorizontalShift
  370.         set temp.top to integer(item 4 of line count of myRegions)
  371.         set temp.right to integer(item 5 of line count of myRegions) + theHorizontalShift
  372.         set temp.bottom to integer(item 6 of line count of myRegions)
  373.         set the ink of sprite thisSprite to cRegionInk
  374.         set the castNum of sprite thisSprite to cRegionCast
  375.         spriteBox(thisSprite, temp.left, temp.top, temp.right, temp.bottom)
  376.         set thisCast to item 9 of line count of myRegions
  377.         set whichCursor to getaProp(myCast, thisCast)
  378.         set thisCast to thisCast & "_Mask"
  379.         set whichCursorMask to getaProp(myCast, thisCast)
  380.         set whichCursor to [whichCursor, whichCursorMask]
  381.         set the cursor of sprite thisSprite to whichCursor
  382.       end if
  383.       if (item 2 of line count of myRegions = "Z") and (makeType = "N") then
  384.         set thisSprite to count + myFirstSprite - 1
  385.         set temp.left to integer(item 3 of line count of myRegions) + theHorizontalShift
  386.         set temp.top to integer(item 4 of line count of myRegions)
  387.         set temp.right to integer(item 5 of line count of myRegions) + theHorizontalShift
  388.         set temp.bottom to integer(item 6 of line count of myRegions)
  389.         set the ink of sprite thisSprite to cRegionInk
  390.         set the castNum of sprite thisSprite to cRegionCast
  391.         spriteBox(thisSprite, temp.left, temp.top, temp.right, temp.bottom)
  392.         set thisCast to item 9 of line count of myRegions
  393.         set whichCursor to getaProp(myCast, thisCast)
  394.         set thisCast to thisCast & "_Mask"
  395.         set whichCursorMask to getaProp(myCast, thisCast)
  396.         set whichCursor to [whichCursor, whichCursorMask]
  397.         set the cursor of sprite thisSprite to whichCursor
  398.       end if
  399.       next repeat
  400.     end if
  401.     set thisSprite to count + myFirstSprite - 1
  402.     set the backColor of sprite gRobotSprite to 0
  403.     spriteBox(thisSprite, 0, 500, 1, 501)
  404.   end repeat
  405.   set gCurrentEnv to GetEnviro(gCurrentSite)
  406.   if gFightMode and gRobotAlive then
  407.     set the backColor of sprite gRobotSprite to 255
  408.     set the ink of sprite gRobotSprite to 36
  409.     repeat with count = 1 to cMaxRegions
  410.       set thisSprite to count + myFirstSprite - 1
  411.       set the cursor of sprite thisSprite to 0
  412.     end repeat
  413.   end if
  414. end
  415.